<!DOCTYPE html>
<html>

{include file='public/header'}
<body>
    <div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="javascript:void(0)">首页</a>
            <a href="javascript:void(0)">分销中心</a>
            <a><cite>分销商充值排名</cite></a>
        </span>
        <a class="layui-btn layui-btn-small" id="reload" title="刷新">
            <i class="layui-icon" style="line-height:30px"><i class="iconfont">&#xe6aa;</i></i>
        </a>
    </div>
    <div class="x-body">
        <form class="layui-form" lay-filter="searchForm">
            <div class="layui-inline">
                <label class="layui-form-label w-auto">分销商：</label>
                <div id="pMenu"></div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label w-auto">选择短剧：</label>
                <div id="pMenu1" style="width:100%;flex:1"></div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label w-auto">投放渠道：</label>
                <div class="layui-input-inline" style="width:182px">
                    <select name="link_type" id="link_type">
                        <option value="">请选择</option>
                        <option value="1">微信小程序</option>
                        <option value="2">抖音小程序</option>
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label w-auto">日期：</label>
                <div class="layui-inline" id="time" style="display: flex;align-items: center;">
                    <div class="layui-input-inline" style="margin-right:10px">
                        <input type="text" class="layui-input" name="start_date" id="start_date" autocomplete="off" placeholder="开始时间">
                    </div>
                    <div class="layui-form-mid">-</div>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" name="end_date" id="end_date" autocomplete="off" placeholder="结束日期">
                    </div>
                </div>
            </div>
            <div class="layui-inline">
                <button class="layui-btn" style="margin-left: 10px;" lay-submit lay-filter="searchList">搜索</button>
                <button type="reset" id="resetList" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </form>
        <table id="realTimeRecharge" lay-filter="realTimeRecharge">

        </table>
    </div>
    
    <script>
        let dayTime = dayjsFormat(new Date().getTime()/1000,false);
        let params = {
            elem: '#realTimeRecharge'
            , toolbar: '#toolbarDemo'
            , url: `/admin/distribution/distributorRanking` //数据接口
            , where:{
                start_date:dayTime,
                end_date:dayTime,
            }
            , id: 'realTimeRecharge'
            , page:false
            , totalRow:true
            , limit:10
            , cols: [[ //表头
                { field: 'name', title: '分销商名称', align:'center',totalRowText: '总合计：' }
                , { field: 'total_order_amount', title: '充值金额', align:'center', totalRow: '{{= d.TOTAL_NUMS.toFixed(2) }}'}
                , { field: 'time', title: '统计时间', align:'center'}
            ]]
        }
        tableList(params)

        layui.use('laydate', function () {
            var laydate = layui.laydate
            // 日期
            laydate.render({
                elem: '#time',
                range: ['#start_date', '#end_date'],
                format: 'yyyy-MM-dd',
                value: [dayTime,dayTime]
            });
        })

        let selectParams = {
            url: '/admin/distribution/selectList',
            elem: '#pMenu',
            selected: [],
            tips: '选择分销商',
            name: 'distributor_id',
            field_id: 'id',
            field_Name: 'name',
        }
        selectN(selectParams)

        let selectParams1 = {
            url: '/admin/video/select',
            selected: [],
            tips: '选择短剧',
            name: 'video_id',
            field_id: 'id',
            field_Name: 'name',
            elem: '#pMenu1'
        }
        selectN(selectParams1)

    </script>
</body>

</html>